package com.five.monkey.feign.consumer.client.fallback;

import com.five.monkey.feign.consumer.client.GraphFeignClient;
import com.five.monkey.vo.CommonVo;
import com.five.monkey.vo.GraphVo;
import com.five.monkey.vo.PageVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author 狻猊
 * @date 2021/8/10 下午2:15
 */
@Component
public class GraphFeignClientFallback implements GraphFeignClient {

    private static Logger logger = LoggerFactory.getLogger(GraphFeignClientFallback.class);

    @Override
    public CommonVo<GraphVo> findById(Long id) {
        logger.error("/provider/graph/find/by/{id}请求异常。id={}", id);
        return CommonVo.exception(1, "/provider/graph/find/by/{id}请求异常");
    }

    @Override
    public CommonVo<List<GraphVo>> findByUserId(Long userId) {
        logger.error("/provider/graph/find/by/user/{userId}请求异常。userId={}", userId);
        return CommonVo.exception(1, "/provider/graph/find/by/user/{userId}请求异常");
    }

    @Override
    public CommonVo<GraphVo> saveToElasticsearch(GraphVo graphVo) {
        logger.error("/provider/graph/save/to/elasticsearch请求异常。graphVo={}", graphVo);
        return CommonVo.exception(1, "/provider/graph/save/to/elasticsearch请求异常");
    }

    @Override
    public CommonVo<GraphVo> findByIdFromElasticsearch(Long id) {
        logger.error("/provider/graph/find/by/{id}/elasticsearch请求异常。id={}", id);
        return CommonVo.exception(1, "/provider/graph/find/by/{id}/elasticsearch请求异常");
    }

    @Override
    public CommonVo<Boolean> deleteByIdFromElasticsearch(Long id) {
        logger.error("/provider/graph/delete/by/{id}/elasticsearch请求异常。id={}", id);
        return CommonVo.exception(1, "/provider/graph/delete/by/{id}/elasticsearch请求异常");
    }

    @Override
    public CommonVo<List<GraphVo>> findAllFromElasticsearch() {
        logger.error("/provider/graph/find/all/elasticsearch请求异常。");
        return CommonVo.exception(1, "/provider/graph/find/all/elasticsearch请求异常");
    }

    @Override
    public CommonVo<PageVo<GraphVo>> pageByStatusFromElasticsearch(Integer status, int page, int size) {
        logger.error("/provider/graph/page/by/{status}/elasticsearch请求异常。status={},page={},size={}", status, page, size);
        return CommonVo.exception(1, "/provider/graph/page/by/{status}/elasticsearch请求异常");
    }

    @Override
    public CommonVo<List<GraphVo>> listByStatusFromElasticsearch(Integer status) {
        logger.error("/provider/graph/list/by/{status}/elasticsearch请求异常。status={}", status);
        return CommonVo.exception(1, "/provider/graph/list/by/{status}/elasticsearch请求异常");
    }
}
